import { BackgroundTooltip } from "./BackgroundTooltip";
import { LabelToolTip } from "./LabelToolTip";
import { ToolTipInfo } from "../../../model/ToolTipInfo";
import { CrossBossDropTipRender } from "../../crossBoss/CrossBossDropTipRender";
import { EquipmentTooltip } from "./EquipmentTooltip";
import { Log } from "../../../../../com/gengine/debug/Log";
import { PetEquipTooltip } from "./PetEquipTooltip";
import { ItemTooltip } from "./ItemTooltip";
import { SkillToolTip } from "./SkillToolTip";
import { WXSkillToolTip } from "./WXSkillToolTip";
import { GuildSkillToolTip } from "./GuildSkillToolTip";
import { ShortItemToolTip } from "./ShortItemToolTip";
import { MountsToolTip } from "./MountsToolTip";
import { BuffToolTip } from "../../avatar/BuffToolTip";
import { SeparateTooltip } from "./SeparateTooltip";
import { BournTooltip } from "./BournTooltip";
import { RootTargetTip } from "./RootTargetTip";
import { RepairCostTooltip } from "./RepairCostTooltip";
import { HolyRuneToolTip } from "./skillRune/HolyRuneToolTip";
import { ToolTipCompareInfo } from "./skillRune/ToolTipCompareInfo";
import { NormalRuneToolTip } from "./skillRune/NormalRuneToolTip";
import { MagicWeaponToolTip } from "./MagicWeaponToolTip";
import { PetLifeStyleTooltip } from "./PetLifeStyleTooltip";
import { MountStartsTargetToolTip } from "./MountStartsTargetToolTip";
import { MountEquipTooltip } from "./MountEquipTooltip";
import { SpriteToolTip } from "./SpriteToolTip";
//class NormalTooltip
    
    export  class NormalTooltip extends BackgroundTooltip
    {
        constructor()
        {
            super();
            return;
        }

        public /* override */ get height(): number
        {
            return scaleBg.height;
        }

        public dispose(): void
        {
            if (this.contains(contentContainer)) 
            {
                this.removeChild(contentContainer);
            }
            return;
        }

        public /* override */ set data(arg1)
        {
            var loc1=null;
            var loc2=0;
            if (contentContainer && this.contains(contentContainer)) 
            {
                this.removeChild(contentContainer);
            }
            if (typeof arg1 === "string") 
            {
                if (arg1 != "") 
                {
                    contentContainer = new LabelToolTip(arg1);
                    this.addChild(contentContainer);
                    super.data = arg1;
                }
            }
            else if (typeof arg1 === "tooltipinfo") 
            {
                loc1 = arg1 as ToolTipInfo;
                var loc3=arg1.type;
                switch (loc3) 
                {
                    case NormalTooltip.ToolTipRenderType_Text:
                    {
                        if (this.labelToolTip) 
                        {
                            this.labelToolTip.data = loc1.tooltipData;
                        }
                        else 
                        {
                            this.labelToolTip = new LabelToolTip(loc1.tooltipData);
                        }
                        contentContainer = this.labelToolTip;
                        break;
                    }
                    case NormalTooltip.ToolTipRenderType_CrossBoss:
                    {
                        if (!this.crossBossToolTip) 
                        {
                            this.crossBossToolTip = new CrossBossDropTipRender();
                        }
                        this.crossBossToolTip.data = loc1.tooltipData;
                        contentContainer = this.crossBossToolTip;
                        break;
                    }
                    case NormalTooltip.ToolTipRenderType_Equipment:
                    {
                        loc2 = flash.utils.getTimer();
                        if (this.equipmentTooltip) 
                        {
                            this.equipmentTooltip.data = loc1.tooltipData;
                        }
                        else 
                        {
                            this.equipmentTooltip = new EquipmentTooltip(loc1.tooltipData);
                        }
                        contentContainer = this.equipmentTooltip;
                        Log.debug(String(flash.utils.getTimer() - loc2));
                        break;
                    }
                    case NormalTooltip.ToolTipRenderType_PetEquip:
                    {
                        if (this.petEquipTooltop) 
                        {
                            this.petEquipTooltop.data = loc1.tooltipData;
                        }
                        else 
                        {
                            this.petEquipTooltop = new PetEquipTooltip(loc1.tooltipData);
                        }
                        contentContainer = this.petEquipTooltop;
                        break;
                    }
                    case NormalTooltip.ToolTipRenderType_Item:
                    {
                        if (this.itemTooltip) 
                        {
                            this.itemTooltip.data = loc1.tooltipData;
                        }
                        else 
                        {
                            this.itemTooltip = new ItemTooltip(loc1.tooltipData);
                        }
                        contentContainer = this.itemTooltip;
                        break;
                    }
                    case NormalTooltip.ToolTipRenderType_Skill:
                    {
                        if (this.skillTooltip) 
                        {
                            this.skillTooltip.data = loc1.tooltipData;
                        }
                        else 
                        {
                            this.skillTooltip = new SkillToolTip(loc1.tooltipData);
                        }
                        contentContainer = this.skillTooltip;
                        break;
                    }
                    case NormalTooltip.ToolTipRenderType_WXSkill:
                    {
                        if (this.wxSkillToolTip) 
                        {
                            this.wxSkillToolTip.data = loc1.tooltipData;
                        }
                        else 
                        {
                            this.wxSkillToolTip = new WXSkillToolTip(loc1.tooltipData);
                        }
                        contentContainer = this.wxSkillToolTip;
                        break;
                    }
                    case NormalTooltip.ToolTipRenderType_GuildSkill:
                    {
                        if (this.guildSkillToolTip) 
                        {
                            this.guildSkillToolTip.data = loc1.tooltipData;
                        }
                        else 
                        {
                            this.guildSkillToolTip = new GuildSkillToolTip(loc1.tooltipData);
                        }
                        contentContainer = this.guildSkillToolTip;
                        break;
                    }
                    case NormalTooltip.ToolTipRenderType_ShortcutItem:
                    {
                        if (this.shortcutItemLabelToolTip) 
                        {
                            this.shortcutItemLabelToolTip.data = loc1.tooltipData;
                        }
                        else 
                        {
                            this.shortcutItemLabelToolTip = new ShortItemToolTip(loc1.tooltipData);
                        }
                        contentContainer = this.shortcutItemLabelToolTip;
                        break;
                    }
                    case NormalTooltip.ToolTipRenderType_Mounts:
                    {
                        if (this.mountsToolTip) 
                        {
                            this.mountsToolTip.data = loc1.tooltipData;
                        }
                        else 
                        {
                            this.mountsToolTip = new MountsToolTip(loc1.tooltipData);
                        }
                        contentContainer = this.mountsToolTip;
                        break;
                    }
                    case NormalTooltip.ToolTipRenderType_BUFF:
                    {
                        if (!this.buffToolTip) 
                        {
                            this.buffToolTip = new BuffToolTip();
                        }
                        this.buffToolTip.data = loc1.tooltipData;
                        contentContainer = this.buffToolTip;
                        break;
                    }
                    case NormalTooltip.ToolTipRenderType_Separate:
                    {
                        if (!this.separateTooltip) 
                        {
                            this.separateTooltip = new SeparateTooltip();
                        }
                        this.separateTooltip.data = loc1.tooltipData;
                        contentContainer = this.separateTooltip;
                        break;
                    }
                    case NormalTooltip.ToolTipRenderType_Bourn:
                    {
                        if (!this.bournToolTip) 
                        {
                            this.bournToolTip = new BournTooltip();
                        }
                        this.bournToolTip.data = loc1.tooltipData;
                        contentContainer = this.bournToolTip;
                        break;
                    }
                    case NormalTooltip.ToolTipRenderType_RootTarget:
                    {
                        if (!this.rootTargetTip) 
                        {
                            this.rootTargetTip = new RootTargetTip();
                        }
                        this.rootTargetTip.data = loc1.tooltipData;
                        contentContainer = this.rootTargetTip;
                        break;
                    }
                    case NormalTooltip.ToolTipRenderType_RepairCost:
                    {
                        if (!this.repairCostTooltip) 
                        {
                            this.repairCostTooltip = new RepairCostTooltip();
                        }
                        this.repairCostTooltip.data = loc1.tooltipData;
                        contentContainer = this.repairCostTooltip;
                        break;
                    }
                    case NormalTooltip.ToolTipRenderType_HolyRune:
                    {
                        if (!this.holyRuneToolTip) 
                        {
                            this.holyRuneToolTip = new HolyRuneToolTip();
                        }
                        this.holyRuneToolTip.data = loc1.tooltipData;
                        this.holyRuneToolTip.equiped = ToolTipCompareInfo(loc1).showEquiped;
                        contentContainer = this.holyRuneToolTip;
                        break;
                    }
                    case NormalTooltip.ToolTipRenderType_NormalRune:
                    {
                        if (!this.normalRuneToolTip) 
                        {
                            this.normalRuneToolTip = new NormalRuneToolTip();
                        }
                        this.normalRuneToolTip.data = loc1.tooltipData;
                        contentContainer = this.normalRuneToolTip;
                        this.normalRuneToolTip.equiped = ToolTipCompareInfo(loc1).showEquiped;
                        break;
                    }
                    case NormalTooltip.ToolTipRenderType_MagicWeapon:
                    {
                        if (!this.magicWeaponToolTip) 
                        {
                            this.magicWeaponToolTip = new MagicWeaponToolTip();
                        }
                        this.magicWeaponToolTip.data = loc1.tooltipData;
                        this.magicWeaponToolTip.equiped = ToolTipCompareInfo(loc1).showEquiped;
                        this.magicWeaponToolTip.showUpArrow(ToolTipCompareInfo(loc1).showUp, ToolTipCompareInfo(loc1).upValue);
                        contentContainer = this.magicWeaponToolTip;
                        break;
                    }
                    case NormalTooltip.ToolTipRenderType_PetLifeStyle:
                    {
                        if (!this.petLifeStyleToolTip) 
                        {
                            this.petLifeStyleToolTip = new PetLifeStyleTooltip();
                        }
                        this.petLifeStyleToolTip.data = loc1.tooltipData;
                        contentContainer = this.petLifeStyleToolTip;
                        break;
                    }
                    case NormalTooltip.ToolTipRenderType_MountStartsTarget:
                    {
                        if (!this.mountStartsTargetToolTip) 
                        {
                            this.mountStartsTargetToolTip = new MountStartsTargetToolTip();
                        }
                        this.mountStartsTargetToolTip.data = loc1.tooltipData;
                        contentContainer = this.mountStartsTargetToolTip;
                        break;
                    }
                    case NormalTooltip.ToolTipRenderType_MountEquip:
                    {
                        if (this.mountEquipToolTip) 
                        {
                            this.mountEquipToolTip.data = loc1.tooltipData;
                        }
                        else 
                        {
                            this.mountEquipToolTip = new MountEquipTooltip(loc1.tooltipData);
                        }
                        contentContainer = this.mountEquipToolTip;
                        break;
                    }
                    case NormalTooltip.ToolTipRenderType_Sprite:
                    {
                        if (!this.spriteToolTip) 
                        {
                            this.spriteToolTip = new SpriteToolTip();
                        }
                        this.spriteToolTip.childSprite = loc1.childSprite;
                        this.spriteToolTip.data = loc1.tooltipData;
                        contentContainer = this.spriteToolTip;
                        break;
                    }
                    default:
                    {
                        if (this.labelToolTip) 
                        {
                            this.labelToolTip.data = loc1.tooltipData;
                        }
                        else 
                        {
                            this.labelToolTip = new LabelToolTip(loc1.tooltipData);
                        }
                        contentContainer = this.labelToolTip;
                        break;
                    }
                }
                this.updatePos();
                this.addChild(contentContainer);
                this.cacheAsBitmap = true;
            }
            else if (arg1 is flash.display.DisplayObject) 
            {
                contentContainer.addChild(arg1);
                this.updatePos();
                addChild(contentContainer);
            }
            return;
        }

        /* internal  */updatePosLater(): void
        {
            _width = contentContainer.width + paddingLeft + paddingRight;
            _height = contentContainer.height + paddingTop + paddingBottom;
            contentContainer.y = paddingTop;
            contentContainer.x = paddingLeft;
            super.updateSize(_width, _height);
            return;
        }

        /* internal  */updatePos(): void
        {
            this.updatePosLater();
            return;
        }

        public static /* const */ToolTipRenderType_PetEquip: string="宠物装备";

        public static /* const */ToolTipRenderType_Skill: string="技能";

        public static /* const */ToolTipRenderType_BUFF: string="BUFF";

        public static /* const */ToolTipRenderType_Separate: string="分隔类型";

        public static /* const */ToolTipRenderType_Bourn: string="境界类型";

        public static /* const */ToolTipRenderType_Item: string="非装备物品类型";

        public static /* const */ToolTipRenderType_RootTarget: string="根骨目标类型";

        public static /* const */ToolTipRenderType_RepairCost: string="全部修理费用";

        public static /* const */ToolTipRenderType_WXSkill: string="五行技能";

        public static /* const */ToolTipRenderType_GuildSkill: string="仙盟技能";

        public static /* const */ToolTipRenderType_HolyRune: string="圣符文";

        public static /* const */ToolTipRenderType_NormalRune: string="普通符文";

        public static /* const */ToolTipRenderType_PetLifeStyle: string="宠物元神";

        public static /* const */ToolTipRenderType_ShortcutItem: string="快捷栏技能纯文本类型";

        public static /* const */ToolTipRenderType_Mounts: string="坐骑类型";

        public static /* const */ToolTipRenderType_MagicWeapon: string="法宝类型";

        public static /* const */ToolTipRenderType_MountStartsTarget: string="坐骑炼神目标";

        public static /* const */ToolTipRenderType_MountEquip: string="坐骑装备";

        public static /* const */ToolTipRenderType_Sprite: string="容器Sprite类型";

        public static /* const */ToolTipRenderType_CrossBoss: string="跨服boss";

        public static /* const */ToolTipRenderType_Text: string="纯文本类型";

        public static /* const */ToolTipRenderType_Equipment: string="装备类型";

        /* internal */ /* var */itemTooltip: ItemTooltip;

        /* internal */ /* var */labelToolTip: LabelToolTip;

        /* internal */ /* var */equipmentTooltip: EquipmentTooltip;

        /* internal */ /* var */petEquipTooltop: PetEquipTooltip;

        /* internal */ /* var */skillTooltip: SkillToolTip;

        /* internal */ /* var */bournToolTip: BournTooltip;

        /* internal */ /* var */rootTargetTip: RootTargetTip;

        /* internal */ /* var */repairCostTooltip: RepairCostTooltip;

        /* internal */ /* var */wxSkillToolTip: WXSkillToolTip;

        /* internal */ /* var */guildSkillToolTip: GuildSkillToolTip;

        /* internal */ /* var */holyRuneToolTip: HolyRuneToolTip;

        /* internal */ /* var */normalRuneToolTip: NormalRuneToolTip;

        /* internal */ /* var */petLifeStyleToolTip: PetLifeStyleTooltip;

        /* internal */ /* var */crossBossToolTip: CrossBossDropTipRender;

        /* internal */ /* var */magicWeaponToolTip: MagicWeaponToolTip;

        /* internal */ /* var */mountStartsTargetToolTip: MountStartsTargetToolTip;

        /* internal */ /* var */mountEquipToolTip: MountEquipTooltip;

        /* internal */ /* var */shortcutItemLabelToolTip: ShortItemToolTip;

        /* internal */ /* var */buffToolTip: BuffToolTip;

        /* internal */ /* var */separateTooltip: SeparateTooltip;

        /* internal */ /* var */spriteToolTip: SpriteToolTip;

        /* internal */ /* var */mountsToolTip: MountsToolTip;
    }
